package com.redstar.HappyRefresh.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

@Data
@EqualsAndHashCode(callSuper = false)
public class User implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableLogic
    private Boolean isDeleted; // 逻辑删除, 0未删除, 1删除, 默认为0

    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreated; // 生成时间，自动填充

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtUpdated; // 修改时间，自动填充

    private String nickName; // 用户名

    @Email
    private String email;

    @NotBlank(message = "密码不能为空")
    private String password;

    private String description; // 个人描述

    private Boolean sex; // true为男，false为女

    private Long defaultFavoritesId; // 用户默认收藏夹id

    private Long avatar; // 头像，就是文件id

    @TableField(exist = false)
    private Boolean each;  // 当前用户是否与指定用户相互关注

    @TableField(exist = false)
    private Set<String> roleName; // 角色名称
}
